Levels = [
	null, // Empty!!!
	{
		config: [5, 9, 2, 2], // Map Size, Player Position
		data: [
			1, 1, 1, 1, 1,
			1, 0, 0, 0, 1,
			1, 0, 1, 0, 1,
			1, 0, 2, 0, 1,
			1, 1, 3, 1, 1,
			1, 0, 0, 0, 1,
			1, 0, 0, 0, 1,
			1, 0, 0, 0, 1,
			1, 1, 1, 1, 1
		],
		letters: [
			2, 6, AL.Wall, 3, 6, AL.Equals, 4, 6, AL.Forbid,
			2, 7, AL.Block, 3, 7, AL.Equals, 4, 7, AL.Pushable,
			2, 8, AL.Portal, 3, 8, AL.Equals, 4, 8, AL.Win
		]
	},
	{
		config: [7, 8, 3, 6],
		data: [
			0, 0, 0, 0, 0, 0, 0,
			1, 1, 1, 1, 1, 1, 1,
			1, 0, 0, 0, 1, 3, 1,
			1, 0, 0, 0, 1, 1, 1,
			1, 0, 0, 0, 0, 0, 1,
			1, 0, 0, 0, 0, 0, 1,
			1, 0, 0, 0, 0, 0, 1,
			1, 1, 1, 1, 1, 1, 1
		],
		letters: [
			3, 1, AL.Portal, 4, 1, AL.Equals, 5, 1, AL.Win,
			3, 5, AL.Wall, 4, 5, AL.Equals, 5, 5, AL.Forbid
		]
	},
	{
		config: [9, 10, 6, 2],
		data:
			[
				0, 0, 0, 1, 1, 1, 1, 1, 1,
				1, 1, 1, 1, 0, 0, 0, 0, 1,
				1, 3, 1, 1, 0, 0, 0, 0, 1,
				1, 1, 2, 1, 0, 0, 0, 0, 1,
				1, 0, 0, 1, 0, 0, 0, 0, 1,
				1, 0, 0, 1, 1, 0, 1, 1, 1,
				1, 0, 0, 2, 0, 0, 0, 0, 1,
				1, 0, 0, 0, 0, 0, 0, 0, 1,
				1, 0, 0, 0, 0, 0, 0, 0, 1,
				1, 1, 1, 1, 1, 1, 1, 1, 1
			],
		letters:
			[
				1, 1, AL.Wall, 2, 1, AL.Equals, 3, 1, AL.Forbid,
				6, 4, AL.Block, 7, 4, AL.Equals, 8, 4, AL.Pushable,
				6, 8, AL.Portal, 7, 8, AL.Equals, 8, 8, AL.Win
			]
	},
	{
		config: [9, 11, 8, 6],
		data: [
			0, 0, 0, 0, 0, 0, 0, 0, 0,
			0, 0, 0, 0, 0, 0, 0, 0, 0,
			1, 1, 1, 1, 1, 0, 1, 1, 1,
			1, 3, 1, 0, 5, 0, 0, 0, 1,
			1, 1, 1, 0, 5, 5, 1, 1, 1,
			1, 0, 0, 0, 5, 0, 0, 0, 1,
			1, 0, 0, 0, 5, 0, 0, 0, 1,
			1, 0, 0, 0, 5, 0, 0, 0, 1,
			1, 0, 0, 0, 5, 4, 2, 0, 1,
			1, 4, 4, 4, 5, 0, 0, 0, 1,
			1, 1, 1, 1, 1, 1, 1, 1, 1
		],
		letters: [
			1, 1, AL.Portal, 2, 1, AL.Equals, 3, 1, AL.Win,
			7, 1, AL.Equals, 8, 1, AL.Pushable,
			1, 2, AL.Wall, 2, 2, AL.Equals, 3, 2, AL.Forbid,
			//4, 2, AL.ClosedDoor, 5, 2, AL.Equals, 6, 2, AL.Forbid,
			6, 2, AL.Block, 7, 2, AL.Equals, 8, 2, AL.Pushable,
			6, 4, AL.ClosedDoor, 7, 4, AL.Equals, 8, 4, AL.Forbid
		],
		buttons: [
			6, 9, function (open) {
				window.Bundle.DoorClosed = !open;
				window.Bundle.updateWallState();
			},
			2, 10, function (open, g) {
				window.Bundle.ButtonState[0] = open;
				window.Bundle.updateBlock(g);
			},
			3, 10, function (open, g) {
				window.Bundle.ButtonState[1] = open;
				window.Bundle.updateBlock(g);
			},
			4, 10, function (open, g) {
				window.Bundle.ButtonState[2] = open;
				window.Bundle.updateBlock(g);
			}
		],
		events: [
			"onStart", function (g) {
				window.Bundle.DoorClosed = true;
				window.Bundle.ButtonState = [false, false, false];
				window.Bundle.updateWallState = function () {
					if (window.Bundle.DoorClosed) {
						let Length = g.Map.length;
						for (let i = 0; i < Length; i++) {
							if (g.Map[i] === 6 && g.playerPos !== i && !g.Letters[i])
								g.Map[i] = 5;
						}
					} else {
						let Length = g.Map.length;
						for (let i = 0; i < Length; i++) {
							if (g.Map[i] === 5 && g.playerPos !== i && !g.Letters[i])
								g.Map[i] = 6;
						}
					}
				};
				window.Bundle.updateBlock = function (g) {
					let S = window.Bundle.ButtonState;
					console.log(S);
					if (S[0] && S[1] && S[2]) {
						g.setTile(3, 4, 0);
						g.setTile(3, 5, 0);
						g.setTile(2, 5, 0);
					}
				}
			},
			"onMove", function () {
				window.Bundle.updateWallState();

			}
		]
	}
]
;